package com.practice.reflection;

import com.practice.network.IpAddress;

public class InstantiationPractice {
	public static void run() {
		
		//Package pkg = Package.getPackage("com.practice.employ");
		
		Class<? extends Object> cls = null;		
		Object obj = null;
		try {
			cls = Class.forName(IpAddress.class.getName()); // "com.practice.IpAddress"
			obj = cls.newInstance();
		} catch (ClassNotFoundException ex) {
			ex.printStackTrace();
		} catch (Exception ex){
			ex.printStackTrace();
		}
		
		if (obj == null) {
			System.out.println("No instance.");
		} else {
			if (obj instanceof IpAddress) {
				System.out.println("It is IpAddress.");
			} else {
				System.out.println(obj.getClass().toString());
			}	
		}
		
	}
}
